package com.hospital.post.mapper;

import com.hospital.common.pojo.TPostContent;
import com.hospital.common.pojo.TPostMeta;
import com.hospital.common.pojo.TReport;
import com.hospital.common.pojo.TSection;
import com.hospital.post.vo.PostContentVo;
import com.hospital.post.vo.PostMetaVo;
import com.hospital.post.vo.SectionVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface PostMapper
{

    List<TSection> getSections();

    List<SectionVo> getAllSections();

    List<PostMetaVo> getPosts(@Param("sectionId") Long sectionId,
                              @Param("pinnedOnly") Integer pinnedOnly,
                              @Param("startRow") Integer startRow,
                              @Param("pageSize") Integer pageSize);

    List<PostContentVo> getTopPostDetail(@Param("postId") Long postId,
                                         @Param("startRow") Integer startRow,
                                         @Param("pageSize") Integer pageSize,
                                         @Param("LZOnly") Long LZOnly);

    List<PostContentVo> getSubPostDetail(@Param("pId") Long pId,
                                         @Param("startRow") Integer startRow,
                                         @Param("subPageSize") Integer subPageSize);

    Integer getPostCount(@Param("sectionId") Long sectionId,
                         @Param("pinnedOnly") Integer pinnedOnly);

    Integer getPostDetailCount(@Param("postId") Long postId,
                               @Param("LZOnly") Long LZOnly);

    Integer getSubPostDetailCount(@Param("pId") Long pId);

    Integer addPostMeta(TPostMeta postMeta);

    Integer addPostContent(TPostContent postContent);

    List<PostContentVo> getFloor(@Param("floorId") Long floorId,
                                 @Param("subPageSize") Integer subPageSize);

    List<TPostMeta> getPostMetaById(@Param("metaId") Long metaId);

    Integer updatePostMeta(TPostMeta postMeta);

    Integer selectFavorate(@Param("userId") Long userId,
                           @Param("metaId") Long metaId);

    Integer addFavorate(@Param("userId") Long userId,
                        @Param("metaId") Long metaId);

    Integer deleteFavorate(@Param("userId") Long userId,
                           @Param("metaId") Long metaId);

    Integer updateFavoratePlus(@Param("metaId") Long metaId);

    Integer updateFavorateMinus(@Param("metaId") Long metaId);

    Integer getFavoritesCount(@Param("userId") Long userId);

    List<PostMetaVo> getFavorites(@Param("userId") Long userId,
                                  @Param("startRow") Integer startRow,
                                  @Param("pageSize") Integer pageSize);

    List<PostMetaVo> getTopPosts(@Param("sectionId") Long sectionId);

    List<PostMetaVo> getNotTopPosts(@Param("sectionId") Long sectionId,
                                    @Param("startRow") Integer startRow,
                                    @Param("pageSize") Integer pageSize);

    Integer updatePostMetaLike(@Param("metaId") Long metaId,
                               @Param("likeCount") Integer likeCount);

    Integer addResource(@Param("userId") Long userId,
                        @Param("metaId") Long metaId,
                        @Param("contentId") Long contentId,
                        @Param("attachmentPath") String attachmentPath);

    List<Long> getAuthorIdByMetaId(@Param("metaId") Long metaId);

    Integer deletePost(@Param("metaId") Long metaId,
                       @Param("userId") Long userId);

    List<Long> getAuthorIdByFloorId(@Param("floorId") Long floorId);

    Integer deleteFloor(@Param("floorId") Long floorId,
                        @Param("userId") Long userId);

    Integer deleteFloors(@Param("metaId") Long metaId,
                         @Param("userId") Long userId);

    Integer addReport(TReport report);

    List<Long> getSectionIdByMetaId(@Param("metaId") Long metaId);

    Integer getMyPostsCount(@Param("userId") Long userId);

    List<PostMetaVo> getMyPosts(@Param("userId") Long userId,
                                @Param("startRow") Integer startRow,
                                @Param("pageSize") Integer pageSize);

    Integer getMyRepliesCount(@Param("userId") Long userId);

    List<PostContentVo> getMyReplies(@Param("userId") Long userId,
                                     @Param("startRow") Integer startRow,
                                     @Param("pageSize") Integer pageSize);

    List<String> getPostTitleByMetaId(@Param("metaId") Long metaId);
}
